import { useState,useEffect } from 'react'
import './App.css'
import {useClipboard} from 'use-clipboard-copy'
import React from 'react'
import {message} from 'antd'
import 'antd/dist/antd.css'

function App() {
  const ref=React.createRef()
  console.log(ref)
  useEffect(()=>{
    console.log(ref)
  },[])
  // 提醒用户复制成功
  const clipboard= useClipboard()
  const doCopy=function(){
    clipboard.copy()
    message.success('成功复制到剪贴板')
  }

  return (
    <div className="App">
      <input type="text" ref={clipboard.target} />
      <button onClick={doCopy}>copy</button>
    </div>
  )
}

export default App
